<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="vue.js"></script>
    <link href="z5.css" rel="stylesheet" type="text/css">


</head>
<body>


    <div id="root">

        <ul>
            <li :class={active:istrue==index} class="style" v-for="item,index in namelist" @click="dian(index)" >{{item}}</li>
        </ul>
    </div>
    
    <script>
        new Vue({
            el:"#root",
            data:{
                namelist:["教父","阿甘正传","楚门的世界","盗梦空间"],
                istrue:0,
                
            },
            methods:{
                dian(index){    
                    this.istrue = index;
                },

            }
        })
    </script>
</body>
</html>